export default {
  data () {
    return {
      list: []
    }
  },
  methods: {
    getSchoolList () {
      return new Promise((resolve, reject) => {
        let that = this
        that.$http.getArea().then(res => {
          if (res.code === 20000) {
            for (let i = 0; i < res.data.child.length; i++) {
              if (res.data.child[i].areaName === sessionStorage.getItem('area')) {
                res.data.child[i].child.map((item) => {
                  this.list.push({
                    id: item.id,
                    name: item.areaName
                  })
                })
              }
            }
            resolve(this.list[0])
          } else {
            that.$message.error(res.msg)
          }
        })
      })
    }
  }
}
